﻿<%@ Page Language="C#" MasterPageFile="../../MasterPage.Master" AutoEventWireup="true" CodeBehind="ICM_Inventory_Repair.aspx.cs" Inherits="KPIS.GERP.GIMS.APP.APP_UI.Form.ICM_Inventory_Repair" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="server">
<script type="text/javascript">
            function openStatusEdit(icm_repair_seq)
            {
                   radopen("../Edit_Form/ICM_Inventory_Repair.aspx?icm_repair_seq="+icm_repair_seq+"&status="+"Edit","WindowDetail" );
            }
            function openStautsAdd()
            {
                   radopen("../Edit_Form/ICM_Inventory_Repair.aspx"+ "?icm_repair_seq="+""+"&status="+"Add" ,"WindowDetail");
            }
            function closeRadWindow(sender, args) {
                   $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest('Receive');
            }
</script>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
                    <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="grdInventoryRepair" LoadingPanelID="RadAjaxLoadingPanel1" />
                                <telerik:AjaxUpdatedControl ControlID="btnInsert" LoadingPanelID="RadAjaxLoadingPanel1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                        <telerik:AjaxSetting AjaxControlID="grdInventoryRepair">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="grdInventoryRepair" LoadingPanelID="RadAjaxLoadingPanel1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                    </AjaxSettings>    
</telerik:RadAjaxManager>
<div class="moduleContent1000">
           <div class="moduleDivBottom1000">
                 <asp:Panel ID="Panel2" runat="server" CssClass="contentPaneDiv" Height="30px" ScrollBars="Auto" >
                            <table cellpadding="0" cellspacing="0">
                                <tr class="command-list">
                                    <td>
                                        <asp:LinkButton ID="btnInsert" runat="server" CausesValidation="false" CssClass="LinkButton" OnClick="btnInsert_Click">
                                        <img alt="" src="../Image/Grid/AddRecord.gif" style="border:0px;vertical-align:middle;" />&#160;&#160;เพิ่มข้อมูลใหม่ </asp:LinkButton>
                                    </td>
                                </tr>
                            </table>
                  </asp:Panel>
            </div>
</div>
<div class="moduleContent1000">
              <div class="moduleDivBottom1000">
                 <asp:Panel ID="Panel1" runat="server" CssClass="contentPaneDiv" Height="322px" ScrollBars="Auto" align = "center" >    
                           <div class="header-grid" align="left">
                                <asp:Label ID="Label4" runat="server" Text="แสดงรายการซ่อมบำรุง"></asp:Label>
                           </div>
                           <table>                          
                                                     <tr>
                                                              <td>
                                                                     <asp:Panel runat ="server" ID="PanelCombo">
                                                                                <table>
                                                                                       <tr>
                                                                                              <td>
                                                                                                         <asp:Label ID="lblStatusRequest" runat = "server" Text ="กรองสถานะของการซ่อมแซม" />
                                                                                              </td>
                                                                                              <td>
                                                                                                         <telerik:RadComboBox ID="cmbStatusRepair" Runat="server" AutoPostBack="true" 
                                                                                                           OnSelectedIndexChanged="cmbStatusRepair_OnSelectedIndexChanged"
                                                                                                           DataTextField="status_name" DataValueField="repair_status" >
                                                                                                         </telerik:RadComboBox>
                                                                                              </td>
                                                                                       </tr>
                                                                                </table>
                                                                      </asp:Panel>  
                                                              </td>
                                                     </tr>
                           </table>                          
                           <table>
                                  <tr>
                                        <td>
                                            <telerik:RadGrid ID="grdInventoryRepair" runat="server" AutoGenerateColumns="false"
                                                                AllowMultiRowEdit="false" AllowMultiRowSelection="true" ShowStatusBar="true"
                                                                Width="945px" Height="230px" AllowPaging="true" AllowFilteringByColumn="true"
                                                                GroupingSettings-GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;"
                                                                GroupingSettings-GroupContinuedFormatString=""
                                                                GroupingSettings-GroupContinuesFormatString=""
                                                                GroupingSettings-GroupSplitFormat="" PageSize ="4" 
                                                                OnNeedDataSource="grdInventoryRepair_NeedDataSource"
                                                                OnItemCommand="grdInventoryRepair_ItemCommand" align ="left">
                                                                <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1" GroupLoadMode="Client"
                                                                ShowGroupFooter="true" 
                                                                DataKeyNames="icm_repair_seq" NoMasterRecordsText="< ไม่มีข้อมูล >" GroupsDefaultExpanded="true">
                                                            <RowIndicatorColumn>
                                                                <HeaderStyle Width="20px" />
                                                            </RowIndicatorColumn>
                                                            <ExpandCollapseColumn>
                                                                <HeaderStyle Width="20px" />
                                                            </ExpandCollapseColumn>
                                                         <Columns>   
                                                                <telerik:GridBoundColumn DataField="icm_repair_seq" 
                                                                    HeaderText="icm_repair_seq" UniqueName="icm_repair_seq"
                                                                    FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                                                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false" >
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridBoundColumn DataField="icm_repair_date" DataFormatString="{0:d}"
                                                                    HeaderText="วันทีส่งซ่อม" UniqueName="icm_repair_date"
                                                                    FilterControlWidth="100%" AutoPostBackOnFilter="true" AllowFiltering = "true"
                                                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="70px"
                                                                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridTemplateColumn DataField="asset_code" HeaderText="รหัสพัสดุที่ส่งซ่อม" ShowFilterIcon="false" HeaderStyle-Font-Bold="true" AllowFiltering = "true"
                                                                        HeaderStyle-Width="160px" HeaderStyle-HorizontalAlign="Center" FilterControlWidth="100%" AutoPostBackOnFilter="true"  UniqueName="asset_code">
                                                                        <ItemTemplate >                                                                                                                           
                                                                                <asp:LinkButton ID="targetControl" runat="server" Text='<%# Eval("asset_code") %>' 
                                                                                OnClientClick='<%# string.Format("return openStatusEdit(\"{0}\");", Eval("icm_repair_seq")) %>'  > 
                                                                                </asp:LinkButton>
                                                                        </ItemTemplate>
                                                                </telerik:GridTemplateColumn>
                                                                <telerik:GridBoundColumn DataField="icm_repair_descr" 
                                                                    HeaderText="รายละเอียดในการส่งซ่อม" UniqueName="icm_repair_descr"
                                                                    FilterControlWidth="100%" AutoPostBackOnFilter="true" AllowFiltering = "true"
                                                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                                                                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridBoundColumn DataField="icm_cause" 
                                                                    HeaderText="สาเหตุที่ส่งซ่อม" UniqueName="icm_cause"
                                                                    FilterControlWidth="100%" AutoPostBackOnFilter="true" AllowFiltering = "true"
                                                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="120px"
                                                                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridBoundColumn DataField="organize_send_repair" 
                                                                    HeaderText="หน่วยงานที่ทำเรื่องซ่อม" UniqueName="organize_send_repair"
                                                                    FilterControlWidth="100%" AutoPostBackOnFilter="true" AllowFiltering = "true"
                                                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="130px"
                                                                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridBoundColumn DataField="icm_dealer_repair_name" 
                                                                    HeaderText="บริษัที่รับซ่อม" UniqueName="icm_dealer_repair_name"
                                                                    FilterControlWidth="100%" AutoPostBackOnFilter="true" AllowFiltering = "true"
                                                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="130px"
                                                                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridBoundColumn DataField="repair_status_name" 
                                                                    HeaderText="สถานะการส่งซ่อม" UniqueName="repair_status_name"
                                                                    FilterControlWidth="100%" AutoPostBackOnFilter="true" AllowFiltering = "true"
                                                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="65px" 
                                                                    HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridTemplateColumn AllowFiltering="false" UniqueName="Delete" HeaderText="ลบ" HeaderStyle-Width="35px" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" > 
                                                                    <FilterTemplate></FilterTemplate>
                                                                    <ItemTemplate>
                                                                             &nbsp;&nbsp;&nbsp;
                                                                             <asp:ImageButton ID="cmdDelete" runat="server" CommandName="DataDelete"
                                                                                ImageUrl="~/App_UI/Image/Grid/Delete.gif" OnClientClick="javascript:return confirm('ยืนยันการลบข้อมูลที่เลือก')"
                                                                                ToolTip="ลบรายการ" width="17" /> 
                                                                    </ItemTemplate>
                                                                </telerik:GridTemplateColumn>
                                                            </Columns>
                                                            <PagerStyle Mode="NumericPages" AlwaysVisible="true" 
                                                                                            FirstPageToolTip="กลับหน้าแรก" LastPageToolTip="ไปหน้าสุดท้าย" 
                                                                                            NextPagesToolTip="หน้าถัดไป" NextPageToolTip="หน้าถัดไป" 
                                                                                            PrevPagesToolTip="ย้อนกลับ" PrevPageToolTip="ย้อนกลับ" />
                                                            </MasterTableView>
                                                            <GroupingSettings GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;" 
                                                                                GroupContinuedFormatString="" GroupContinuesFormatString="" 
                                                                                GroupSplitFormat="" />
                                                            <ClientSettings EnableRowHoverStyle="True">
                                                                <Selecting AllowRowSelect="true" />
                                                                <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                                                            </ClientSettings>
                                                      </telerik:RadGrid>
                                        </td>
                                  </tr>
                           </table>
                 </asp:Panel>
              </div>
</div>                           
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" >
    <Windows>
        <telerik:RadWindow ID="WindowDetail" runat="server" Width="1016px" Height="534px"
            showcontentduringload="false"  VisibleStatusbar="false"
            Modal="true" Skin = "Vista" behaviors="Close"
            title="แสดงรายการซ่อมบำรุง" 
            OnClientClose="closeRadWindow" >
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager> 
</asp:Content>

